package com.jt.service;

import com.jt.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("userService")
public class StaticProxy implements UserService {

    @Autowired
    private UserService target;

    public void addUser(User user) {
        try {
            System.out.println("事务开始");
            target.addUser(user);
            System.out.println("事务结束");
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("事务回滚");
        }
    }
}
